package com.zero.manage.web.components.controller;

import com.zero.manage.web.components.base.BaseController;
import com.zero.manage.web.components.entity.rbac.SysRoleEntity;
import com.zero.manage.web.components.query.SysRoleQuery;
import com.zero.manage.web.components.service.SysRoleService;
import io.gitee.zerowsh.enums.ToolEnums;
import io.gitee.zerowsh.util.PublicResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统角色 控制层
 *
 * @author zero
 */
@RestController
@RequestMapping("sysRole")
@Api(tags = "系统角色")
public class SysRoleController extends BaseController<SysRoleEntity, String, SysRoleService, SysRoleQuery> {
    @Autowired
    private SysRoleService sysRoleService;

    @GetMapping("updateState")
    @ApiOperation(value = "修改角色状态", notes = "修改角色状态")
    public PublicResult updateState(@RequestParam String id, @RequestParam ToolEnums.StateEnums state) {
        return sysRoleService.updateState(id, state);
    }

    @GetMapping("getIdAndName")
    @ApiOperation(value = "获取角色编号和名称", notes = "获取启用角色编号和名称")
    public PublicResult getIdAndName() {
        return sysRoleService.getIdAndName();
    }
}